Repository navigation
fix(search): slice Postgres FTS chunk inserts into bounded batches (#2133) - #2135
Open
zaidrain06 wants to merge 1 commit into
Open
zaidrain06 wants to merge 1 commit into
zaidrain06 wants to merge 1 commit into
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…asicmachines-co#2133) Signed-off-by: Said Yagmur <zaidrain06@users.noreply.github.com>
zaidrain06
force-pushed
the
fix-postgres-fts-chunk-slice-2133
branch
from
November 19, 2026 16:11
70ced1d to
e04afb0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #2133
Slices PostgreSQL full-text search chunk writes (
INSERT INTO search_index_fts_chunks ... FROM jsonb_to_recordset(CAST(:chunks AS JSONB))) into bounded JSONB batches (POSTGRES_FTS_CHUNK_INSERT_MAX_ROWS = 200orPOSTGRES_FTS_CHUNK_INSERT_MAX_BYTES = 2_000_000, whichever comes first) inside the caller's existing session and transaction.Changes
src/basic_memory/repository/postgres_fts_chunks.py: AddedPOSTGRES_FTS_CHUNK_INSERT_MAX_ROWS = 200,POSTGRES_FTS_CHUNK_INSERT_MAX_BYTES = 2_000_000, andslice_postgres_fts_chunk_json_batches()to partition serialized chunk payloads by row count and UTF-8 byte size.src/basic_memory/repository/postgres_search_repository.py: Updated_replace_fts_chunksto execute oneINSERT ... FROM jsonb_to_recordsetper bounded slice inside the same session/transaction.src/basic_memory/repository/accepted_note_search_repository.py: UpdatedAcceptedNoteSearchRepository.refresh_entityto use the same bounded slicing forINSERT_ACCEPTED_NOTE_FTS_CHUNKS_SQL.tests/repository/test_accepted_note_search_repository.py: Added tests verifying multi-statement slicing on >200-chunk notes, tail token preservation, and byte-cap splitting.Verification
INSERTstatement with identical row payloads.statement_timeoutwhile preserving fix(core): replace an entity's search rows in one transaction #1623 transaction atomicity.